%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/basics"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 38, 39, 40, 11, 13, 28<br />2: PgSelectInlineApply[33]<br />3: PgSelect[8]<br />ᐳ: Access[34]<br />4: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 34<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 34, 15<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 35, 36<br />2: PgSelectRows[29]"):::bucket
    Bucket3("Bucket 3 (listItem)<br /><br />ROOT __Item{3}ᐸ29ᐳ[30]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 31<br /><br />ROOT PgSelectSingle{3}ᐸmessagesᐳ[31]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ"]]:::plan
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'YES' ]ᐳ[40]"}}:::plan
    PgSelectInlineApply33["PgSelectInlineApply[33∈0] ➊<br />More deps:<br />- Constantᐸ2ᐳ[38]"]:::plan
    Object11 & Lambda13 & PgSelectInlineApply33 --> PgSelect8
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[39]"}}:::plan
    Lambda28 --> PgSelectInlineApply33
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Access34{{"Access[34∈0] ➊<br />ᐸ8.m.subqueryDetailsFor21ᐳ"}}:::plan
    PgSelect8 --> Access34
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    List35{{"List[35∈2]<br />ᐸ34,15ᐳ"}}:::plan
    Access34 & __Item15 --> List35
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    PgSelectRows29[["PgSelectRows[29∈2]"]]:::plan
    Lambda36{{"Lambda[36∈2]<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    Lambda36 --> PgSelectRows29
    List35 --> Lambda36
    __Item30[/"__Item[30∈3]<br />ᐸ29ᐳ"\]:::itemplan
    PgSelectRows29 ==> __Item30
    PgSelectSingle31{{"PgSelectSingle[31∈3]<br />ᐸmessagesᐳ"}}:::plan
    __Item30 --> PgSelectSingle31
    PgClassExpression32{{"PgClassExpression[32∈4]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle31 --> PgClassExpression32

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28,PgSelectInlineApply33,Access34 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,PgSelectRows29,List35,Lambda36 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item30,PgSelectSingle31 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression32 bucket4

